define(['verifyInput'],function(){
    var currPageObj={};
    currPageObj.init=function(){
        var self = this;
        //新增Template7筛选方法
        Template7.registerHelper('hasChild',function(child){
            return child.length>0?'display:none;':'';
        });
      //新增Template7筛选方法
    	Template7.registerHelper('showImage',function(child){
        	return child.length>0?'display:inline-block;':'display:none;';
    	});
    	
    	if(window.top != window.self){
			window.top.location = "login.jsp";
		}
    	
        
        currPageObj.initEvents();
    };
    
    
	
	function submit(){
		var submit = true;
		$("input[nullmsg]").each(function() {
			if ($("#" + this.name).val() == "") {
				showError($("#" + this.name).attr("nullmsg"));
				submit = false;
				return false;
			}
		});
		if (submit) {
			$('#formLogin').submit();
		}
	}
	
	//显示错误提示
	function showError(str) {
		$('#alertMessage').html(str);
	}
    
    //绑定事件
    currPageObj.initEvents=function(){
        var self = this;
        $("#loginbtn").on('click',function(){//登录
        	submit();
        });
        
        
        $(document).on('keydown',function(e){//回车登录
        	if(e.keyCode == 13) {
    			submit();
    		}
        });
        
        
        
        
    };
    return currPageObj;
});
